#include "dri_beep.h"
#include "dri_led.h"
#include "dri_systick.h"
#include "dri_key.h"
#include "dri_key1.h"
#include "dri_key2.h"
#include "dri_key3.h"
#include "dri_fan.h"

static uint8_t key_sta=0;
static uint8_t key1_sta=0;
static uint8_t key2_sta=0;
static uint8_t key3_sta=0;
void dri_led_liushuideng(void);
int main(void)
{
	
	
	dri_beep_init();
	dri_key_init();
	dri_led1_init();
	dri_led2_init();
	dri_led3_init();
	dri_key1_init();
	dri_key2_init();
	dri_key3_init();
	dri_systick_init(168);
	dri_fan_init();
	dri_led_init();
	
	//dri_beep_open();
	
	while(1)
	{
		
		if(dri_get_key())
		{
				key_sta = ~key_sta;
		}
		
		if(key_sta)
		{
			dri_led1_open();
			dri_systick_ms(1000);
			dri_led1_close();
			dri_systick_ms(1000);
			dri_led2_open();
			dri_systick_ms(1000);
			dri_led2_close();
			dri_systick_ms(1000);
			dri_led3_open();
			dri_systick_ms(1000);
			dri_led3_close();
			dri_systick_ms(1000);
		
		}
		
		else
		{
			dri_led1_close();
			dri_led2_close();
			dri_led3_close();
		}
		
		if(dri_get_key1())
		{
			key1_sta = ~key1_sta;
		}
		if(key1_sta)
		{
			dri_beep_open();
		}
		else
		{
			dri_beep_close();
			
		}
		if(dri_get_key2())
		{
			key2_sta = ~key2_sta;
		}
		if(key2_sta)
		{
			dri_led_open();
		}
		else
		{
			dri_led_close();
			
		}	
		if(dri_get_key3())
		{
			key3_sta = ~key3_sta;
		}
		if(key3_sta)
		{
			dri_fan_open();
		}
		else
		{
			dri_fan_close();
			
		}
		
	}
}

